home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97b.txt
/
000092_icon-group-sender _Thu Oct 23 17:59:19 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by cheltenham.cs.arizona.edu (8.8.7/8.8.7) with SMTP id RAA09006
for <icon-group-addresses@cheltenham.CS.Arizona.EDU>; Thu, 23 Oct 1997 17:59:18 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA23922; Thu, 23 Oct 1997 17:59:18 -0700
From: gep2@computek.net
Date: Thu, 23 Oct 1997 18:08:20 -0500
Message-Id: <199710232308.SAA04895@axp.cmpu.net>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Subject: tabulating values
To: icon-group@cs.arizona.edu
X-Mailer: SPRY Mail Version: 04.00.06.17
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
>Hello. I am trying to write up a program that takes a list of values and
counts their frequency of occurence (like a word count, but with
numbers). (I'll eventually make a histogram out of the results.) For
example, given the following output
1
2
1
3
10
100
I'd like the following output
value n
1 2
2 1
3 1
10 1
100 1
In fact, it's EXACTLY a "word" count... since a "word" can be made up of numeric
characters just as well as alphabetic ones! Surely there are word count
programs already in the library.
The only thing that might be different would come when it's time to do the sort
for the output, so you get them in the order you indicated and not in
string-sort order (1,10,100,2,3...) but you can probably get that by just
ensuring that you convert the values to numeric before storing them in your
table (in SNOBOL4, and probably in ICON, you convert a numeric string variable
value to a number by simply adding a unary "+" on the front of the variable
name...)
If there's not something in the library to do this, it's because the job is _so_
trivial that there's little reason to do a library routine for it...
Gordon Peterson
http://www.computek.net/public/gep2/
Support the Anti-SPAM Amendment! Join at http://www.cauce.org/